home *** CD-ROM | disk | FTP | other *** search
/ IBM InfoROM for OS/2 Beta 1995 January / IBM InfoROM for OS2 Beta 1-1995.ISO / testcert / mmedia / system / ap2 / scripts / c1____i9.p2s < prev    next >
Encoding:
Text File  |  1993-12-17  |  8.0 KB  |  362 lines

  1. # DESCRIPTION:
  2. # --------------------------------------------------------------
  3. #
  4. # open and switch through all valid states for cdda in three
  5. # different processes, only one sound device, one cd with da disc
  6. # installed, will involve resource contention for sound device and
  7. # cd, include masteraudio set/query for each process.
  8. # [switch mode each device[switch state each device]].
  9. #
  10. # --------------------------------------------------------------
  11. #
  12. @PROCESSES=2
  13. @EVENTS={THREAD1=1,THREAD2=0,BREAKPOINT=0}
  14. #
  15. defaultconnection cdaudio00 make type cd stream to ampmix totype amp stream wait
  16. #
  17. @PROCESS 1
  18. @BREAK              A CDDA WILL NEED TO BE IN THE DEFAULT CD-ROM
  19. @SET_EVENT BREAKPOINT 1
  20. ;
  21. ; set masteraudio level for session to 80% - will affect both
  22. ; processes
  23. ;
  24. masteraudio volume 80 wait
  25. ;
  26. ; open cdaudio device non-exclusively
  27. ;
  28. open cdaudio00 alias cdda1 shareable notify
  29. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_OPEN #1
  30. @WAIT_NOTIFY 1
  31. @WAIT_NOTIFY 21 30000
  32. ;
  33. ; no way of knowing which open (in which process) was the last
  34. ; to complete. All opens were non-exclusive. Need to do an
  35. ; acquire to make sure process 1 has the active instance
  36. ;
  37. acquire cdda1 wait
  38. @WAIT_PASSDEVICE cdda1 30000
  39. ;
  40. ; set cd to streaming mode
  41. ;
  42. connector cdda1 enable type cd stream notify
  43. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CONNECTOR #2
  44. @WAIT_NOTIFY 2 30000
  45. ;
  46. ; cue cd for play
  47. ;
  48. cue cdda1 output notify
  49. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CUE #3
  50. @WAIT_NOTIFY 3 30000
  51. ;
  52. ; play cd asynchronously
  53. ;
  54. play cdda1
  55. @PAUSE 2000
  56. ;
  57. ; close cd device instance
  58. ;
  59. close cdda1 wait
  60. ;
  61. ; open another cd device instance non-exclusively
  62. ;
  63. open cdaudio00 alias cdda1_1 shareable wait
  64. acquire cdda1_1
  65. @WAIT_PASSDEVICE cdda1_1
  66. ;
  67. ; set cd to streaming mode
  68. ;
  69. connector cdda1_1 enable type cd stream wait
  70. ;
  71. ; cue cd for play
  72. ;
  73. cue cdda1_1 output wait
  74. ;
  75. ; play cd for 5 seconds
  76. ;
  77. play cdda1_1 notify
  78. +MM_MCINOTIFY MCI_NOTIFY_ABORTED MCI_PLAY
  79. @PAUSE 5000
  80. ;
  81. @SET_EVENT THREAD1 0
  82. @SET_EVENT THREAD2 1
  83. @WAIT_EVENT THREAD1
  84. ;
  85. ; recover control of resource (cd device/acpa) from process 3.
  86. ;
  87. ; recover exclusive control of resource (cd device/acpa) from
  88. ; process 3
  89. ;
  90. acquire cdda1_1 exclusive notify
  91. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #6
  92. @WAIT_NOTIFY 6 30000
  93. @WAIT_PASSDEVICE cdda1_1 30000
  94. @PAUSE 5000
  95. ;
  96. ; release exclusive control of resource
  97. ;
  98. release cdda1_1 wait
  99. ;
  100. @SET_EVENT THREAD1 0
  101. @SET_EVENT THREAD2 1
  102. @WAIT_EVENT THREAD1 45000
  103. ;
  104. acquire cdda1_1 wait
  105. @WAIT_PASSDEVICE cdda1_1 30000
  106. #
  107. stop cdda1_1 notify
  108. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_STOP #8
  109. @WAIT_NOTIFY 8 30000
  110. ;
  111. ; seek to start of first track on CD
  112. ;
  113. seek cdda1_1 to start notify
  114. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_SEEK #10
  115. @WAIT_NOTIFY 10 30000
  116. ;
  117. @SET_EVENT THREAD1 0
  118. @SET_EVENT THREAD2 1
  119. @WAIT_EVENT THREAD1 45000
  120. ;
  121. ; recover control of resource (cd device/acpa) from process 3
  122. ;
  123. acquire cdda1_1 notify
  124. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #11
  125. @WAIT_NOTIFY 11 30000
  126. @WAIT_PASSDEVICE cdda1_1 30000
  127. ;
  128. ; disable cd stream connector
  129. ;
  130. connector cdda1_1 disable type cd stream notify
  131. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CONNECTOR #12
  132. @WAIT_NOTIFY 12 30000
  133. ;
  134. ; play cd. No connectors enabled so play is invalid
  135. ;
  136. play cdda1_1 notify
  137. =!ERROR
  138. ;
  139. ; enable headphones (default) connector
  140. ;
  141. connector cdda1_1 enable type headphones wait
  142. ;
  143. ; play in non-streaming mode for 3 seconds
  144. ;
  145. play cdda1_1 notify
  146. +MM_MCINOTIFY MCI_NOTIFY_ABORTED MCI_PLAY
  147. @PAUSE 3000
  148. ;
  149. @SET_EVENT THREAD1 0
  150. @SET_EVENT THREAD2 1
  151. @WAIT_EVENT THREAD1 45000
  152. ;
  153. ;
  154. ; recover exclusive control of resource (cd device) from process 3
  155. ;
  156. acquire cdda1_1 exclusive notify
  157. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #16
  158. @WAIT_NOTIFY 16 30000
  159. @WAIT_PASSDEVICE cdda1_1 30000
  160. ;
  161. ; stop play
  162. ;
  163. stop cdda1_1 notify
  164. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_STOP #17
  165. @WAIT_NOTIFY 17 30000
  166. ;
  167. ; release exclusive control of resource (cd device) from process 3
  168. ;
  169. release cdda1_1 wait
  170. ;
  171. @SET_EVENT THREAD1 0
  172. @SET_EVENT THREAD2 1
  173. @WAIT_EVENT THREAD1 45000
  174. ;
  175. ; instance is inactive. Do some statuses
  176. ;
  177. status cdda1_1 time format wait
  178. =mmtime
  179. ;
  180. status cdda1_1 ready wait
  181. =true
  182. ;
  183. ; close cd instance for process 1 (cd1_1)
  184. ;
  185. close cdda1_1 notify
  186. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CLOSE #20
  187. @WAIT_NOTIFY 20 30000
  188. ;
  189. @SET_EVENT THREAD1 0
  190. @SET_EVENT THREAD2 1
  191. ;
  192. ;
  193. @PROCESS 2
  194. @WAIT_EVENT BREAKPOINT
  195. ;
  196. ; open a non-exclusive cdaudio instance for process 2
  197. ;
  198. open cdaudio00 alias cdda2 shareable notify
  199. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_OPEN #21
  200. ;
  201. @WAIT_EVENT THREAD2
  202. ;
  203. ; query the session masteraudio setting. Remember process 1
  204. ; changed it to 80%. Now change it to 50%
  205. ;
  206. masteraudio query volume wait
  207. =80
  208. masteraudio volume 50 wait
  209. masteraudio query volume wait
  210. =50
  211. ;
  212. acquire cdda2 wait
  213. @WAIT_PASSDEVICE cdda2 30000
  214. #
  215. connector cdda2 enable type cd stream notify
  216. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CONNECTOR #22
  217. @WAIT_NOTIFY 22 30000
  218. ;
  219. ; change time format to track-minutes-seconds-frames format
  220. ;
  221. set cdda2 time format tmsf wait
  222. ;
  223. ; seek to track 3
  224. ;
  225. seek cdda2 to 3 notify
  226. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_SEEK #23
  227. @WAIT_NOTIFY 23 30000
  228. ;
  229. ; play asynchronously for 3 seconds
  230. ;
  231. play cdda2
  232. @PAUSE 3000
  233. ;
  234. ; close device instance
  235. ;
  236. close cdda2 wait
  237. ;
  238. ; open cdaudio device instance non-exclusively
  239. ;
  240. open cdaudio00 alias cdda2_1 shareable wait
  241. ;
  242. ; change time format to track-minutes-seconds-frames format
  243. ;
  244. acquire cdda2_1
  245. @WAIT_PASSDEVICE cdda2_1 30000
  246. ;
  247. set cdda2_1 time format tmsf wait
  248. ;
  249. ; enable cd stream connector
  250. ;
  251. connector cdda2_1 enable type cd stream wait
  252. ;
  253. ; cue for play
  254. ;
  255. cue cdda2_1 output wait
  256. ;
  257. ; play for 3 seconds
  258. ;
  259. play cdda2_1 notify
  260. +MM_MCINOTIFY MCI_NOTIFY_ABORTED MCI_PLAY
  261. @PAUSE 3000
  262. ;
  263. @SET_EVENT THREAD2 0
  264. @SET_EVENT THREAD1 1
  265. @WAIT_EVENT THREAD2 45000
  266. ;
  267. ; recover control from process 1
  268. ;
  269. acquire cdda2_1 notify
  270. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #24
  271. @WAIT_NOTIFY 24 30000
  272. @WAIT_PASSDEVICE cdda2_1 30000
  273. #
  274. pause cdda2_1 notify
  275. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_PAUSE #25
  276. @WAIT_NOTIFY 25 30000
  277. ;
  278. @SET_EVENT THREAD2 0
  279. @SET_EVENT THREAD1 1
  280. @WAIT_EVENT THREAD2 45000
  281. ;
  282. ; recover control from process 1
  283. ;
  284. acquire cdda2_1 notify
  285. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #26
  286. @WAIT_NOTIFY 26 30000
  287. @WAIT_PASSDEVICE cdda2_1 30000
  288. ;
  289. ; resume play for 3 seconds
  290. ;
  291. resume cdda2_1 notify
  292. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_RESUME
  293. @PAUSE 2000
  294. ;
  295. @SET_EVENT THREAD2 0
  296. @SET_EVENT THREAD1 1
  297. @WAIT_EVENT THREAD2 45000
  298. ;
  299. ; recover control from process 1
  300. ;
  301. acquire cdda2_1 notify
  302. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #29
  303. @WAIT_NOTIFY 29 30000
  304. @WAIT_PASSDEVICE cdda2_1 30000
  305. #
  306. seek cdda2_1 to start notify
  307. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_SEEK #30
  308. @WAIT_NOTIFY 30 30000
  309. ;
  310. acquire cdda2_1 notify
  311. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #31
  312. @WAIT_NOTIFY 31 30000
  313. @WAIT_PASSDEVICE cdda2_1 30000
  314. #
  315. connector cdda2_1 disable type cd stream notify
  316. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CONNECTOR #32
  317. @WAIT_NOTIFY 32 30000
  318. ;
  319. ; no connections now. Need to re-enable headphones connector,
  320. ; asynchronously
  321. ;
  322. connector cdda2_1 enable type headphones
  323. @PAUSE 2000
  324. ;
  325. ; play for 3 seconds
  326. ;
  327. play cdda2_1 notify
  328. +MM_MCINOTIFY MCI_NOTIFY_ABORTED MCI_PLAY
  329. @PAUSE 3000
  330. ;
  331. #
  332. stop cdda2_1 notify
  333. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_STOP #37
  334. @WAIT_NOTIFY 37 30000
  335. ;
  336. status cdda2_1 time format wait
  337. =tmsf
  338. ;
  339. @SET_EVENT THREAD2 0
  340. @SET_EVENT THREAD1 1
  341. @WAIT_EVENT THREAD2 45000
  342. #
  343. acquire cdda2_1 notify
  344. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #38
  345. @WAIT_NOTIFY 38 30000
  346. @WAIT_PASSDEVICE cdda2_1 30000
  347. #
  348. seek cdda2_1 to end notify
  349. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_SEEK #39
  350. @WAIT_NOTIFY 39 30000
  351. ;
  352. ; close cd device instance for this process
  353. ;
  354. close cdda2_1 notify
  355. +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CLOSE #40
  356. @WAIT_NOTIFY 40 30000
  357. ;
  358. @SET_EVENT THREAD2 0
  359. @SET_EVENT THREAD1 1
  360. ;
  361. ;
  362.